package com.ysq.hebt.webview.action.imple;

import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.ysq.hebt.basic.impl.BasicActionSupportImpl;
import com.ysq.hebt.common.entity.LoginUser;
import com.ysq.hebt.common.util.CommonUtil;
import com.ysq.hebt.webview.action.IPwdMemoAction;
import com.ysq.hebt.webview.service.IPwdMemoService;

/**
 * 密码备忘
 * @author Administrator
 *
 */
@Controller("pwdMemoAction")
@Scope("prototype")
public class PwdMemoAction extends BasicActionSupportImpl implements IPwdMemoAction{
	Logger logger = CommonUtil.getLogger(PwdMemoAction.class);
	private static final long serialVersionUID = 1L;

	@Resource(name = "pwdMemoService")
	protected IPwdMemoService pwdMemoService;
	
	/**
	 * 查询备忘列表
	 */
	public void getPwdMemoList(){
		logger.debug("getPwdMemoList ... ");
		
		String jsonResult = "";
		
		LoginUser user = CommonUtil.getSessionUser();
		
		try {
			jsonResult = pwdMemoService.getPwdMemoList(user,  start, limit);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		CommonUtil.printAjaxResult(jsonResult);
	}
	
	/**
	 * 插入新的 memo
	 */
	public void insertPwdMemo(){
		logger.debug("insertPwdMemo ...");
		
		LoginUser user = CommonUtil.getSessionUser();
		
		String resultJson = pwdMemoService.insertFieldView(user, pwdMemoInfo);
		
		CommonUtil.printAjaxResult(resultJson);
	}
	
	/**
	 * 修改 memo
	 */
	public void editPwdMemo(){
		logger.debug("editPwdMemo...");
		
		LoginUser user = CommonUtil.getSessionUser();
		
		String resultJson = pwdMemoService.editPwdMemo(user, pwdMemoInfo);
		CommonUtil.printAjaxResult(resultJson);
	}
	
	/**
	 * 删除memo
	 */
	public void deletePwdMemos(){
		logger.debug("deletePwdMemos ...");
		
		String resultJson = pwdMemoService.deletePwdMemos(intIdArrayStr);
		
		CommonUtil.printAjaxResult(resultJson);
	}
	
}
